package com.treasure.mall.biz.service.core.order;

import com.treasure.mall.biz.base.SearchableCrudService;
import com.treasure.mall.biz.dto.order.OrderSaveDTO;
import com.treasure.mall.biz.dto.order.OrderUpdateDTO;
import com.treasure.mall.biz.entity.embeddable.ReceivingInfo;
import com.treasure.mall.biz.entity.order.DealOrderPO;
import com.treasure.mall.biz.entity.order.SubOrderPO;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/6/11
 */
public interface DealOrderService extends SearchableCrudService<DealOrderPO, String> {
    /**
     * 创建订单
     *
     * @param orderSaveDTO
     * @return
     */
    DealOrderPO create(OrderSaveDTO orderSaveDTO);


    /**
     * 订单支付
     *
     * @param orderPO
     */
    @Transactional
    void orderPayed(DealOrderPO orderPO);

    /**
     * 订单返利与结算
     *
     * @param subOrderPO
     */
    void rebate(SubOrderPO subOrderPO);

    @Transactional
    void orderPayed(String orderId);

    /**
     * 得到没有支付的订单
     *
     * @return
     */
    List<DealOrderPO> findUnPayedOrders();

    void initScheduled();

    /**
     * 修改订单信息
     *
     * @param orderUpdateDTO
     */
    DealOrderPO updateOrder(OrderUpdateDTO orderUpdateDTO);

    void updateOrderShipInfoByOrderId(String orderId, ReceivingInfo receivingInfo);
}
